{extend name="index/index" /}

{block name="navigation"}
<nav class="main-nav">
    <div class="menu-top-menu-container">
        <ul id="menu-top-menu" class="clearfix">
            <li><a href="{:url('index/index/index')}">首页</a></li>
            <li><a href="{:url('index/Recall/index')}">韶华追忆</a></li>
            <li><a href="{:url('index/Mood/index')}">心情随笔</a></li>
            <li class="current-menu-item"><a href="{:url('index/Share/index')}">技术分享</a></li>
            <li><a href="{:url('index/Post/index')}">技术讨论</a></li>
            <!--<li><a href="{:url('index/Archive/index')}">个人归档</a></li>-->
            <li><a href="{:url('/index/Me/index')}">关于我</a></li>
        </ul>
    </div>
</nav>
{/block}

{block name="indexmain"}
{css href="/static/index/assets/libs/bootstrap/css/bootstrap.min.css"}
{js href="/static/index/assets/libs/bootstrap/js/bootstrap.min.js"}
{js href="/static/index/js/jquery.min.js"}
{css href="/static/index/css/toastr.min.css" }
{js href="/static/index/js/toastr.min.js"}

<!-- Start of Page Container -->
<div class="page-container">
    <div class="container">
        <div class="row">

            <!-- start of page content -->
            <div class="span8 page-content" style="margin-top: 30px;">

                {volist name='lists'  id='v' }
                <article class="format-standard type-post hentry clearfix">

                    <header class="clearfix">

                        <h3 class="post-title">
                            <a href="{:url('index/share/detail',['id'=>$v['art_id']])}">{$v.artname}</a>
                        </h3>

                        <div class="col-md-12 col-sm-12 col-xs-7 post-meta clearfix">
                            <span class="date">{$v.arttime}</span>

                            <span class="comments"><a href="#" >评论（{$v.num}）</a></span>

                            <span  class="glyphicon glyphicon-eye-open" class="like-count" style="position: relative;right:22px; color:#AAAAAA;">浏览（{$v.views}）</span>
                            <!--<span style="position: relative;right:64px; color:#AAAAAA;">浏览（{$v.views}）</span>-->
                            <span class="like-count"  datalove = '{$v.art_id}'>{$v.artlove}</span>
                        </div><!-- end of post meta -->

                    </header>
                    <p  id='p' style="
                                                        height: 55px;/*border: 1px solid black;*/
                                                        overflow:hidden;
                                                        text-overflow:ellipsis;
                                                        display: -webkit-box;
                                                        -webkit-line-clamp:3;
                                                        -webkit-box-orient:vertical;
                                                        ">
                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                        {$v.arttext}

                    </p>
                </article>
                {/volist}

            </div>
            <!-- end of page content -->

            <!-- start of sidebar -->
            <aside class="span4 page-content">

                <section class="widget" style="margin-top: 30px;">
                    <div class="support-widget">
                        <h3 class="title">我是博主啦</h3>
                        <p class="intro">关于我的一些心情和分享的一些小的知识呢，大家也可以积极的讨论...</p>
                    </div>
                </section>

                <section class="widget">
                    <h3 class="title">热门文章</h3>
                    <ul class="articles">
                        {volist name='love'  id='val' }
                        <li class="article-entry standard">
                            <h4><a href="single.html">{$val.artname}</a></h4>
                            <span class="article-meta">{$val.arttime}</span>
                            <span class="like-count"  datalove = '{$val.art_id}'>{$val.artlove}</span>
                        </li>
                        {/volist}

                    </ul>
                </section>

                <section class="widget">
                    <h3 class="title">友情连接</h3>
                    <ul id="recentcomments">
                        {volist name='links' id='val'}
                        <li class="recentcomments"><a href='{$val.linksurl}'>{$val.linksname}</a></li>
                        {/volist}
                    </ul>
                </section>

            </aside>
            <!-- end of sidebar -->
        </div>
    </div>
</div>
<!-- End of Page Container -->

<script type="text/javascript">
    toastr.options = {
        closeButton: true,// 是否显示关闭按钮
        progressBar: true,// 实现显示计时条
        timeOut: "2000",// 自动关闭时间
        positionClass: "toast-top-right"// 提示位置
        // positionClass: "toast-top-full-width"// 提示位置
        // toast-top-full-width 顶端，宽度铺满整个屏幕
        // toast-top-right  顶端右边
    };

    $('#sta').click(function (){

        toastr.error('你尚未登录');

    });


</script>

<!-- 点赞的ajax -->

<script type="text/javascript">

    $('.like-count').click(function (){
        var info = 'artid' + '=' + $(this).attr('datalove');
        var thisbtn = $(this);
        // alert(info);
        $.ajax({
            type: 'post',
            url: '/index/share/artlove',
            data: info,
            dataType : 'json',
            success : function (data){
                if(data.status){
                    // toastr.success('点赞成功');
                    thisbtn.html(data.love);
                    thisbtn.attr('style','color:blue;');

                    // window.location.reload();

                }else{
                    toastr.error('点赞失败');
                }
            },
            error : function () {
                alert('执行失败');

            }
        });

    });

</script>

<!-- 点赞的ajax -->

{/block}